//
//  ICMBalancePayObjModel.m
//  ICrEAM
//
//  Created by xphone on 16/11/29.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ICMBalancePayObjModel.h"

@implementation ICMBalancePayObjModel

- (void)setUpBalanceBasicInfoModelWithBalanceBasicInfoModel:(ICMBalanceBasicInfoModel *)model{
    //结算收费对象代码
    self.PAYMENT_OBJECT_CODE = model.OWNER_NO;
    //结算收费对象名称
    self.PAYMENT_OBJECT_NAME = model.OWNER_NAME;
    
    if ([model.RO_REPAIR_TYPE_NAME isEqualToString:@"质量担保保养"]) {
        self.PAYMENT_OBJECT_CODE = @"999999999999";
        self.PAYMENT_OBJECT_NAME = @"上汽大众";
    }
    
    //应收销售材料费  默认为零
    self.RECEIVEABLE_SALES_PART_FEE = @"0";
   
    //应收附加服务费
    self.RECEIVEABLE_ADD_SER_FEE = @"0";
    //应收总金额
    self.RECEIVEABLE_TOTAL_AMOUNT = model.REPAIR_AMOUNT;
    //实收销售材料费
    self.REAL_SALES_PART_FEE = @"0";
    //实收附加服务费用
    self.REAL_ADD_SER_FEE = @"0";
    //税率
    self.TAX = @"0.17";
    //已收账款
    self.RECEIVED_AMOUNT = @"0";
    //已免账款
    self.DERATED_AMOUNT = @"0";
    //龙卡抵扣金额
    self.DRAGON_CARD_AMOUNT = @"0";
    //传空值
    self.CUS_RECEIVE_SORT = @"";
}

- (void)setUpBalanceBasicInfoModelWithBalanceInfoView:(ICMBalanceInfoView *)balanceBasicInfoView{
    //应收税额
    self.RECEIVEABLE_TAX_MOUNT = [NSString stringWithFormat:@"%.2f",[balanceBasicInfoView.amountAccounts.subtitleLabel.text doubleValue]-([balanceBasicInfoView.amountAccounts.subtitleLabel.text doubleValue]/1.17)];
    //应收维修材料费
    self.RECEIVEABLE_REPAIR_PART_FEE = balanceBasicInfoView.partAccounts.subtitleLabel.text;
    //应收工时费
    self.RECEIVEABLE_LABOUR_FEE = balanceBasicInfoView.labourAccounts.subtitleLabel.text;
    //应收总金额
    self.RECEIVEABLE_TOTAL_AMOUNT = balanceBasicInfoView.amountAccounts.subtitleLabel.text;
    //实收维修材料费
    self.REAL_REPAIR_PART_FEE = balanceBasicInfoView.partRealPrice.subtitleLabel.text;
    //实收工时费
    self.REAL_LABOUR_FEE = balanceBasicInfoView.labourRealPrice.subtitleLabel.text;
   //实收税额
    self.REAL_TAX_MOUNT = balanceBasicInfoView.tax.subtitleLabel.text;
    //实收总金额
    self.REAL_TOTAL_AMOUNT = balanceBasicInfoView.amountRealPrice.subtitleLabel.text;
    //汇总金额
    self.SUM_AMOUNT = balanceBasicInfoView.amountRealPrice.subtitleLabel.text;
    //圆整金额
    self.RMB_AMOUNT = balanceBasicInfoView.RMBAmount;
    //应收账款
    self.RECEIVABLE_AMOUNT = balanceBasicInfoView.accounts.subtitleLabel.text;
    //税额
    self.TAX_AMOUNT = balanceBasicInfoView.tax.subtitleLabel.text;
    //不含税金额
    self.NET_AMOUNT = balanceBasicInfoView.endAmount.subtitleLabel.text;
    //未收账款
    self.NOT_RECEIVED_AMOUNT = balanceBasicInfoView.accounts.subtitleLabel.text;
    //大众一家积分抵扣金额
    self.HQ_VW_USED_CREDIT_AMOUNT = balanceBasicInfoView.VWUseIntegralView.contentText;
    //预扣兑换待查
    self.HQ_VW_PRE_DEDUCT_CREDIT_AMOUNT = balanceBasicInfoView.exchangeAmountView.contentText;
    //经销商本地会员积分抵扣工时金额
    self.SVW_LABR_DEDUCT_CRDT_AMT = balanceBasicInfoView.labourHourIntegralView.contentText;
    //经销商本地会员积分抵扣材料金额
    self.SVW_DEDUCT_CRDT_AMT = balanceBasicInfoView.partIntegralView.contentText;
    //经销商本地会员积分抵扣总金额
    self.SVW_CRRNT_USED_CRDT_AMT = [NSString stringWithFormat:@"%.2f",[self.SVW_LABR_DEDUCT_CRDT_AMT doubleValue]+[self.SVW_DEDUCT_CRDT_AMT doubleValue]];
    //经销商优惠券材料抵扣金额
    self.LABOUR_DEDUCT_AMOUNT = balanceBasicInfoView.labourDeduction.subtitleLabel.text;
    //经销商优惠券材料抵扣金额
    self.MATERIAL_DEDUCT_AMOUNT = balanceBasicInfoView.partDeduction.subtitleLabel.text;
    //经销商优惠券抵扣总金额
    self.COUPON_TOTAL_AMOUNT = [NSString stringWithFormat:@"%.2f",[self.LABOUR_DEDUCT_AMOUNT doubleValue]+[self.MATERIAL_DEDUCT_AMOUNT doubleValue]];
    //去零金额
    self.SUB_OBB_AMOUNT = balanceBasicInfoView.amountDeduction.subtitleLabel.text;
    //会员编号
    self.MEMBER_NO = balanceBasicInfoView.memberIDView.contentText;
    //卡号
    self.CARD_ID = balanceBasicInfoView.CARD_ID;
}

- (void)setUpBalanceBasicInfoModelWithBalanceInfoSKDView:(ICMBalanceInfoSKDView *)balanceBasicInfoView{
    //车友汇会员总部积分抵扣金额
    self.SKD_HQTRS_CRDT_AMT = balanceBasicInfoView.SKDDeductionView.contentText;
    //车友汇会员经销商分会积分抵扣金额
    self.SKD_DEALER_CRDT_AMT = balanceBasicInfoView.SSTDeductionView.contentText;
    //应收税额
    self.RECEIVEABLE_TAX_MOUNT = [NSString stringWithFormat:@"%.2f",[balanceBasicInfoView.amountAccounts.subtitleLabel.text doubleValue]-([balanceBasicInfoView.amountAccounts.subtitleLabel.text doubleValue]/1.17)];
    //应收维修材料费
    self.RECEIVEABLE_REPAIR_PART_FEE = balanceBasicInfoView.partAccounts.subtitleLabel.text;
    //应收工时费
    self.RECEIVEABLE_LABOUR_FEE = balanceBasicInfoView.labourAccounts.subtitleLabel.text;
    //应收总金额
    self.RECEIVEABLE_TOTAL_AMOUNT = balanceBasicInfoView.amountAccounts.subtitleLabel.text;
    //实收维修材料费
    self.REAL_REPAIR_PART_FEE = balanceBasicInfoView.partRealPrice.subtitleLabel.text;
    //实收工时费
    self.REAL_LABOUR_FEE = balanceBasicInfoView.labourRealPrice.subtitleLabel.text;
    //实收税额
    self.REAL_TAX_MOUNT = balanceBasicInfoView.tax.subtitleLabel.text;
    //实收总金额
    self.REAL_TOTAL_AMOUNT = balanceBasicInfoView.amountRealPrice.subtitleLabel.text;
    //汇总金额
    self.SUM_AMOUNT = balanceBasicInfoView.amountRealPrice.subtitleLabel.text;
    
    //经销商优惠券材料抵扣金额
    self.LABOUR_DEDUCT_AMOUNT = balanceBasicInfoView.labourDeduction.subtitleLabel.text;
    //经销商优惠券材料抵扣金额
    self.MATERIAL_DEDUCT_AMOUNT = balanceBasicInfoView.partDeduction.subtitleLabel.text;
    //经销商优惠券抵扣总金额
    self.COUPON_TOTAL_AMOUNT = [NSString stringWithFormat:@"%.2f",[self.LABOUR_DEDUCT_AMOUNT doubleValue]+[self.MATERIAL_DEDUCT_AMOUNT doubleValue]];
    //圆整金额
    self.RMB_AMOUNT = balanceBasicInfoView.RMBAmount;
    //应收账款
    self.RECEIVABLE_AMOUNT = balanceBasicInfoView.accounts.subtitleLabel.text;
    //税额
    self.TAX_AMOUNT = balanceBasicInfoView.tax.subtitleLabel.text;
    //不含税金额
    self.NET_AMOUNT = balanceBasicInfoView.endAmount.subtitleLabel.text;
    //未收账款
    self.NOT_RECEIVED_AMOUNT = balanceBasicInfoView.accounts.subtitleLabel.text;
    //去零金额
    self.SUB_OBB_AMOUNT = balanceBasicInfoView.amountDeduction.subtitleLabel.text;
}


@end
